﻿using System;
using ExFlash.Tags;

namespace ExFlash.Records
{
    static class SoundDataFactory
    {
        public static SoundData GetSoundData(AudioCodingFormat format, int soundLength)
        {
            switch (format)
            {
                case AudioCodingFormat.UncompressedNative:
                    {
                        return new UncompressedSoundData(soundLength);
                    }
                case AudioCodingFormat.ADPCM:
                    {
                        return new ADPCMSoundData(soundLength);
                    }
                case AudioCodingFormat.MP3:
                    {
                        return new MP3SoundData(soundLength);
                    }
                case AudioCodingFormat.UncompressedLittleEndian:
                    {
                        return new UncompressedSoundData(soundLength);
                    }
                case AudioCodingFormat.Nellymoser16KHZ:
                case AudioCodingFormat.Nellymoser8KHZ:
                case AudioCodingFormat.Nellymoser:
                    {
                        return new NellymoserSoundData(soundLength);
                    }
                case AudioCodingFormat.Speex:
                    {
                        return new SpeexSoundData(soundLength);
                    }
                default:
                    throw new ArgumentException("Unknown Sound Format");
            }
        }
    }
}
